import mysql.connector

# 建立连接
try:
    cnx = mysql.connector.connect(
        user='talon',
        password='xhwykzv',
        host='localhost',
        database='talon'
    )
    print('连接成功！')

    # 关闭连接
    cnx.close()
    print('连接已关闭。')

except mysql.connector.Error as err:
    print(f'连接失败：{err}')
